﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace Common.Library.HTTP
{
    public class ChromeClient
    {
        /// 伪装成谷歌
        /// 

        #region Get
        /// <summary>
        /// Get请求 
        /// </summary>
        /// <param name="requestUrl">请求地址</param>
        /// <returns></returns>
        public static HttpResponseMessage Get(string requestUrl, int timeOut = 60)
        {
            var response = new HttpResponseMessage();
            using (var http = new HttpClient())
            {
                http.Timeout = new TimeSpan(0, 0, timeOut);
                try
                {
                    response = http.GetAsync(requestUrl).Result;
                    return response;
                }
                catch (Exception)
                {

                    response = new HttpResponseMessage(System.Net.HttpStatusCode.RequestTimeout) { Content = new StringContent("请求超时") };
                    return response;
                }
            }
        }
        #endregion

        #region Post

        #endregion

    }
}
